#include "CreateUserMessage.h"



CreateUserMessage::CreateUserMessage( BYTE* _buff )
	:PipeMessage(PipeMessage::CREATE_USER)
{
	if(_buff)
	{
		mBuffer = _buff;
		ParseBuffer();
	}
}

UINT CreateUserMessage::CreateBuffer( UINT _startPos /*= 0*/ )
{
	memcpy_s(mBuffer + _startPos, sizeof(mData), &mData, sizeof(mData));
	_startPos +=  sizeof(mData);

	return _startPos;
}

void CreateUserMessage::ParseBuffer()
{
	memcpy_s(&mData, sizeof(mData), mBuffer + sizeof(MessageType),  sizeof(mData));
}

UINT CreateUserMessage::GetBufferSize()
{
	return sizeof(mData);
}

void CreateUserMessage::SetData( string _username, string _password )
{
	strcpy_s(mData.username, sizeof(mData.username),_username.c_str());
	strcpy_s(mData.password, sizeof(mData.password),_password.c_str());
}

void CreateUserMessage::SetResult( int _result )
{
	mData.result = _result;
}

